package com.udi.project.business.collection.Thread;


import com.udi.common.utils.spring.SpringUtils;
import com.udi.project.business.collection.mapper.MarkMapper;
import com.udi.project.business.utils.redis.RedisUtils;
import org.springframework.stereotype.Component;


import java.util.ArrayList;
import java.util.List;

/**
 * @author Admin
 * 向UDI字段标记此UDI是否已经贴在医疗器械上
 */
public class MarkDate extends Thread{
    private RedisUtils redisUtils;
    private MarkMapper markMapper;


    public MarkDate(){
        this.redisUtils = SpringUtils.getBean(RedisUtils.class);
        this.markMapper = SpringUtils.getBean(MarkMapper.class);
    }

    @Override
    public void run() {

        List<Object> stringList = redisUtils.lGet("PrintGs1",0,-1);
        int ove = 0;
        for(Object udi:stringList) {
            ove = markMapper.updateStatu((String) udi);
        }

        if(ove==0){
            redisUtils.lSet("ThreadHint","{\"messg\":\"状态更新失败\",\"TypeNumber\":5004},");
            redisUtils.set("markMapper","状态更新失败");
        }redisUtils.del("PrintGs1");
    }
}
